﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;

namespace QunYing.Web.market
{
    public partial class orderthree : System.Web.UI.Page
    {
        protected void Page_LoadComplete(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                Repeater rp = ((Repeater) Master.FindControl("NavRepeater"));
                rp.DataSource = NavData();
                rp.DataBind();
            }
        }
        /// <summary>
        /// 快捷导航数据
        /// </summary>
        private DataTable NavData()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("name");
            dt.Columns.Add("url");
            dt.Rows.Add("购物车结算", "orderone.aspx");
            dt.Rows.Add("确认订单信息", "ordertwo.aspx");
            dt.Rows.Add("成功提交订单", "");
            return dt;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }
        private void BindData()
        {
            if (Request["id"]==null)
            { 
                return;
            }
            
            Model.OrderInfo model=new BLL.OrderInfo().GetModel(Convert.ToInt32(Request["id"]));

            DataTable dt = new BLL.OrderDetail().GetList("订单ID="+model.订单ID).Tables[0];
            GridView1.DataSource = dt;
            GridView1.DataBind();

            lblTotalPrice.Text = model.总价==null?"0.00":Convert.ToDecimal(model.总价).ToString("f2");
            lblUseScore.Text = model.总积分 == null ? "0.00" : Convert.ToDecimal(model.总积分).ToString("f2");
            lblGetScore.Text = model.赠送总积分 == null ? "0.00" : Convert.ToDecimal(model.赠送总积分).ToString("f2");
            txtNo.Text = model.订单编号;
            txtUser.Text = model.收件人;
            txtAddress.Text = model.收件地址;
            txtTel.Text = model.联系电话;
            txtMsg.Text = model.用户留言;
        }

        protected void btnBack_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/market.aspx");
        }

       
    }
}
